package com.example.helloworldspringboot.controller;

import com.example.helloworldspringboot.entity.Category;
import com.example.helloworldspringboot.entity.Goods;
import com.example.helloworldspringboot.service.CategoryService;
import com.example.helloworldspringboot.service.GoodsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Controller
public class GoodsController {
    @Autowired
    GoodsService goodsService;

    @RequestMapping("/goods")
    public String getAllGoods(Model model){
        List<Goods> all =  goodsService.queryAllGoods();
        model.addAttribute("username","admin");
        model.addAttribute("data",all);
        return "goods";
    }

}

